import React, { Component } from "react";

//css
import "./index.scss";
import Loginfrom from "./Loginfrom";
import Regisfrom from "./registfrom";
export default class Login extends Component {
  constructor() {
    super();
    this.state = {
      formType: "login",
    };
  }
  //接收子组件传过来的值,并做页面更新啊啊
  switchFrom = (value) => {
    this.setState({ formType: value });
  };
  render() {
    return (
      <div className="form-wrap">
        <div>
          {this.state.formType === "login" ? (
            <Loginfrom switchFrom={this.switchFrom}></Loginfrom>
          ) : (
            <Regisfrom switchFrom={this.switchFrom}></Regisfrom>
          )}
        </div>
      </div>
    );
  }
}
